const calculator = {
    count: 0,
    next(){
        return ++this.count;
    },
    double(a){
        return a * 2;
    },
    add(a,b){
        return a + b;
    }
}
console.log(calculator.count);
calculator.count = 100;
calculator.count = function(){
    console.log(111);
}
for(const key in calculator){
    // 获得对应key的值
    const origin = calculator[key];
    console.log(key);
    console.log(origin);
    console.log();
    
    calculator[key] = function(...args){
        console.log(`开始调用${key}函数`);
        console.log(origin.call(this,...args));
        console.log(`结束调用${key}函数`);
    }
    console.log(calculator[key]);
}

calculator.add(1,3);